home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / timeline / canvas.c < prev    next >
Encoding:
Text File  |  1993-06-15  |  21.1 KB  |  430 lines

  1. /*
  2.  * Copyright (c) 1990, 1991 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/collab/TimeLine/RCS/canvas.c,v 1.0 91/09/30 16:49:33 chua Exp Locker: drapeau $ */
  25. /* $Log:    canvas.c,v $
  26.  * Revision 1.0  91/09/30  16:49:33  chua
  27.  * Update to version 1.0
  28.  * 
  29.  * Revision 0.73  91/09/19  17:28:39  chua
  30.  * Make sure that variables are initialized properly.  Change formatting slightly,
  31.  * so that (if, for, while) statements with only one statement in them will not have
  32.  * braces.
  33.  * 
  34.  * Revision 0.72  91/08/16  16:55:56  chua
  35.  * Moved the DrawCanvas repaint and event handlers to drawCanvas.c
  36.  * The ScrollTimerNotify function is moved there as well.
  37.  * 
  38.  * Revision 0.71  91/08/13  14:32:49  chua
  39.  * In the DrawCanvasEventHandler, detect keyboard events as well.  This is to allow
  40.  * keyboard accelerators for the edit functions (Cut, Copy, Paste and Delete).
  41.  * Cut, Copy and Paste are on the left keypad and Delete is either the Delete or
  42.  * Backspace key.
  43.  * 
  44.  * Also, when the mouse is moved into the DrawCanvas area, the canvas grabs the 
  45.  * keyboard focus.
  46.  * 
  47.  * Revision 0.70  91/08/09  15:11:44  chua
  48.  * Removed the event and repaint handlers for the App canvas.  These are now placed
  49.  * separately in a new file, appCanvas.c
  50.  * 
  51.  * Revision 0.69  91/08/05  16:51:59  chua
  52.  * Deleted the RepaintCanvas routine, as it is no longer necessary.  In places where it
  53.  * is called, just call the ScrollToFirstQuarter routine, which will do the necessary
  54.  * repaint as well.
  55.  * 
  56.  * Revision 0.68  91/08/05  13:00:52  chua
  57.  * No change in code, just some formatting changes.
  58.  * 
  59.  * Revision 0.67  91/08/02  14:26:35  chua
  60.  * Made changes to DrawCanvasEventHandler so that when the mouse is moved off canvas when
  61.  * dragging a note, the note will still be partially visible in the canvas when it is finally
  62.  * 'dropped'.
  63.  * 
  64.  * Revision 0.66  91/08/02  13:25:43  chua
  65.  * Made changes to the moving note code so that it moves correctly under different zoom level
  66.  * and across different canvas mappings.
  67.  * 
  68.  * Revision 0.65  91/08/02  11:40:00  chua
  69.  * In the ScrollTimerNotify and DrawCanvasEventHandler routines, make changes so that
  70.  * dragging notes is now possible.
  71.  * 
  72.  * Revision 0.64  91/07/26  17:21:08  chua
  73.  * In DrawCanvasEventHandler, when an area is deselected, update the fields in the
  74.  * region info popup window to zeros.
  75.  * In DrawCanvasRepaintHandler, when checking if there is a need to draw a selected
  76.  * area, check that the start of the selected area falls in the currently mapped
  77.  * canvas.
  78.  * 
  79.  * Revision 0.63  91/07/24  10:31:36  chua
  80.  * In ScrollTimerNotify, return NOTIFY_DONE.
  81.  * 
  82.  * Revision 0.62  91/07/22  15:15:58  chua
  83.  * Changed the name of the pointer to the blank time popup window to InsertBlankTimePopup,
  84.  * instead of a longer name previously.
  85.  * 
  86.  * Revision 0.61  91/07/18  15:03:50  chua
  87.  * In the DrawCanvasRepaintHandler routine, add the line, DrawGrid, before drawing the
  88.  * instrument cables and notes.
  89.  * 
  90.  * In the DrawCanvasEventHandler, if AddandDisplayNewNote is to be called, first move
  91.  * the x position to the previous closest grid line, so that any new note added will be
  92.  * 'snapped' to a grid line.
  93.  * 
  94.  * Revision 0.60  91/07/17  10:15:14  chua
  95.  * Changed the SetLineAttributes so that it accepts linewidth as a parameter.
  96.  * 
  97.  * Moved four functions to moveCanvas.c.  This are the functions concerned with 
  98.  * checking if scrolling needs to be done.
  99.  * 
  100.  * Introduced a new timer notify function, ScrollTimerNotify, which is activated
  101.  * when the user drags the mouse off the canvas while holding the left button down.
  102.  * This function will automatically scroll the canvas, while increasing the area
  103.  * selected accordingly.
  104.  * 
  105.  * Changes are also made to the DrawCanvasEventHandler routine to incorporate the
  106.  * timer notify function (like when to turn the timer on/off, etc).
  107.  * 
  108.  * Revision 0.59  91/07/09  18:24:46  chua
  109.  * Made changes to the startX, endX variables so that they now store the position at the
  110.  * largest zoom level (zoom level = 1).   Thus, the appropriate multiplication or
  111.  * division by the zoom level has to be made when these variables are used.  This will
  112.  * include lastX (position of the playback head) as well.
  113.  * 
  114.  * Revision 0.58  91/07/09  16:54:32  chua
  115.  * In the DrawCanvasEventHandler, if the playback head is being repositioned, check that
  116.  * a note is not selected. If a note was selected, set startX, endX, startY, endY to be
  117.  * the same as for startnoteX etc, (since startX etc was changed when we click on the
  118.  * canvas).
  119.  * 
  120.  * Revision 0.57  91/06/25  15:49:56  chua
  121.  * Replace all occurrences of the constant HalfSecondScale by the value 5, since the constant is no longer
  122.  * in use.
  123.  * Set the CANVAS_AUTO_SHRINK attribute to FALSE for all the three canvases.  This is necessary so that
  124.  * the actual canvas will be larger than the viewing window.
  125.  * Add a new color, RED, to the colormap.
  126.  * In the AppCanvasRepaintHandler, when calling the InstrumentDrawIcon routine, check if the instrument
  127.  * has been selected and if so, pass in Sunken as the parameter when drawing the icon.  If not, pass in
  128.  * Raised as the parameter.
  129.  * 
  130.  * Revision 0.56  91/06/05  16:13:31  chua
  131.  * Delete the lines setting the attributes CANVAS_AUTO_SHRINK and CANVAS_AUTO_EXPAND for the
  132.  * canvases (not required).  Set the CANVAS_RETAINED attribute to FALSE for the AppCanvas
  133.  * so that the repaint handler is called when the frame is resized.
  134.  * 
  135.  * In the AppCanvasRepaintHandler, set the width of the AppCanvas as well as set the height
  136.  * of the other canvases.  (This is to avoid improper sizes of the canvases during resizing).
  137.  * 
  138.  * Revision 0.55  91/06/04  17:37:10  chua
  139.  * Added the copyright comments in the beginning of the file.
  140.  * 
  141.  * Revision 0.54  91/06/04  17:19:23  chua
  142.  * In the DrawCanvasEventHandler routine, only call DeleteNote if the frame is not a 
  143.  * Clipboard.
  144.  * 
  145.  * In the DrawCanvasRepaintHandler routine, if the frame is a clipboard, draw a thick line
  146.  * signifying the end of the clipboard on the canvas (so that the user can distinguish how
  147.  * much space has been cut onto the clipboard.
  148.  * 
  149.  * Revision 0.53  91/06/04  10:42:10  chua
  150.  * Added a call to UpdateHeader whenever there is a change in the status of
  151.  * the current document (the change flag set to 1).
  152.  * 
  153.  * Revision 0.52  91/06/03  11:10:25  chua
  154.  * 
  155.  * 
  156.  * Revision 0.51  91/05/28  12:09:32  chua
  157.  * *** empty log message ***
  158.  * 
  159.  * Revision 0.50  91/05/24  16:35:45  chua
  160.  * *** empty log message ***
  161.  * 
  162.  * Revision 0.49  91/05/23  17:28:52  chua
  163.  * In the AppCanvasEventHandler, when an application is selected, update the message field in the 
  164.  * Insert Blank Time pop-up window, indicating which application was selected.
  165.  * Similarly, in the AppCanvasRepaintHandler, update the message field to none, since clearing the
  166.  * app canvas resets any selected application.
  167.  * 
  168.  * Revision 0.48  91/05/22  16:37:40  chua
  169.  * *** empty log message ***
  170.  * 
  171.  * Revision 0.47  91/05/22  13:54:17  chua
  172.  * Introduced a new variable, noteSelected, which keeps track of whether a note has been 
  173.  * selected.
  174.  * 
  175.  * Revision 0.46  91/05/22  11:35:26  chua
  176.  * *** empty log message ***
  177.  * 
  178.  * Revision 0.45  91/05/17  16:56:42  chua
  179.  * *** empty log message ***
  180.  * 
  181.  * Revision 0.44  91/05/17  16:49:00  chua
  182.  * Minor change in DrawCanvasEventHandler:
  183.  * 
  184.  * When testing if areaSelected is to be set to one, a test is also made to make sure that the
  185.  * starting and ending Y coordinates are not the same before setting areaSelected = 1.
  186.  * Previously, only the X coordinates were tested.
  187.  * 
  188.  * Revision 0.43  91/05/15  15:23:44  chua
  189.  * When an area is selected, any currently selected note will be deselected first before the selected area
  190.  * is drawn.  This is to avoid confusion, since the edit functions (cut, paste, etc) can also be applied 
  191.  * to a selected note, or to a selected region.  So it would be rather confusing to have both a selected
  192.  * note and a selected region at the same time.
  193.  * 
  194.  * Revision 0.42  1991/05/15  02:53:53  chua
  195.  * In the DrawCanvasEventHandler, areaSelected is set to 1 only if startX != endX.  This is
  196.  * to ensure that an area has really been selected before setting the flag to true.
  197.  *
  198.  * Revision 0.41  1991/04/24  00:49:16  chua
  199.  * Added code for dealing with selection procedures.  These include some global variables
  200.  * (areaSelected, startX, endX, startY, endY), and some static variables for dealing with scrolling
  201.  * off the canvas window (scrollHorStart etc).
  202.  * New Functions added are
  203.  *     CheckHorizontalScrolling
  204.  *     CheckVerticalScrolling
  205.  *
  206.  * Much of the DrawCanvasEventHandler routine is changed to accomodate dealing with selection.
  207.  * Also, the DrawCanvasRepaintHandler is changed slightly so that the playback head is redrawn at
  208.  * its original position after the canvas is redrawn with the new notes.
  209.  *
  210.  * Some minor changes were made in the SetCanvasHeight routine on the formula for calculating the
  211.  * canvas heights.
  212.  *
  213.  * The font for the timeline time labels (in the TimeCanvas) is also set to "8x13".
  214.  *
  215.  * Revision 0.40  1991/03/29  01:31:00  chua
  216.  * This file contains the functions for handling all the canvases.
  217.  * There are three canvases used in the TimeLine Editor:  AppCanvas, DrawCanvas and TimeCanvas.
  218.  * CanvasInit is a function to initialize the variables and attributes for all the three canvases.
  219.  * The VerticalScrollHandler and HorizontalScrollHandler functions enable two canvases to scroll simultaneously
  220.  * either verticall or horizontally by the use of just one scroll bar (controlling both canvases)
  221.  * InitializeCMSdata initializes the colormap for the canvases.
  222.  * SetLineAttributes will set the line attribute for the graphics context (GC) used by the canvases.
  223.  * SetCanvasHeight sets the height of each canvas according to how many open applications there are.
  224.  * RepaintCanvas explicitly calls the repaint handlers of all three canvases to repaint all of them.  This is done
  225.  * when new data need to be shown, or when clearing all notes etc.
  226.  * The other functions in this file are the event handlers (which are called when a user clicks or drags a mouse
  227.  * in a canvas) and repaint handlers (either called explicitly, or automatically when the canvas has been damaged,
  228.  * such as when another window overlaps it and is moved away).
  229.  * */
  230.  
  231. static char canvasrcsid[] = "$Header: /Source/Media/collab/TimeLine/RCS/canvas.c,v 1.0 91/09/30 16:49:33 chua Exp Locker: drapeau $";
  232.  
  233. #include "main.h"
  234.  
  235. int paletteName;                            /* Counter to differentiate between the different palette names */
  236. int scrollHorStart, scrollHorEnd;                    /* Horizontal start and end point of the canvas window */
  237. int scrollVerStart, scrollVerEnd;                    /* Vertical start and end point of the canvas window */
  238.  
  239. /*
  240.  * Initialization routine for the canvases.  
  241.  * There are three canvases used.
  242.  * AppCanvas - Icons of the open applications are drawn here.  The user can click on an icon to select a particular application.
  243.  * DrawCanvas - The cables and notes for each application are drawn here.  The playback head is also drawn on this canvas.  This
  244.  * is the 'editing' canvas, where notes are placed by the user.
  245.  * TimeCanvas - The timeline (showing the time for the timeline document) is drawn here.
  246.  * Called by the main program.
  247.  */
  248. void CanvasInit(tlFrame)
  249.      TimeLineFramePtr tlFrame;
  250. {
  251.   u_char    red[NumColors], green[NumColors], blue[NumColors];  /* arrays to hold the RGB values of the colormap */
  252.   int         i;
  253.   int         *xpixels;                        /* array used to hold the index values of the colormap */
  254.   char         cmsName[15];                        /* Win CMS name */
  255.   Notify_client Vobj, Hobj;                        /* Handlers to the scrollbar notify interpose procedures */
  256.   
  257.   tlFrame->paintWinDraw = canvas_paint_window(tlFrame->TimeLine_window->DrawCanvas); /* Get the paint window, display and drawable for all three */
  258.   tlFrame->xidDraw =(Window) xv_get(tlFrame->paintWinDraw, XV_XID);        /* canvases (Draw, App and Time) */
  259.   tlFrame->dpyDraw = (Display *) xv_get(tlFrame->TimeLine_window->DrawCanvas, XV_DISPLAY);
  260.   tlFrame->paintWinApp = canvas_paint_window(tlFrame->TimeLine_window->AppCanvas);
  261.   tlFrame->xidApp =(Window) xv_get(tlFrame->paintWinApp, XV_XID);
  262.   tlFrame->dpyApp = (Display *) xv_get(tlFrame->TimeLine_window->AppCanvas, XV_DISPLAY);
  263.   tlFrame->paintWinTime = canvas_paint_window(tlFrame->TimeLine_window->TimeCanvas);
  264.   tlFrame->xidTime =(Window) xv_get(tlFrame->paintWinTime, XV_XID);
  265.   tlFrame->dpyTime = (Display *) xv_get(tlFrame->TimeLine_window->TimeCanvas, XV_DISPLAY);
  266.   
  267.   tlFrame->gc = XCreateGC(tlFrame->dpyDraw, tlFrame->xidDraw, 0, 0); /* Create the graphic context, one for drawing the playback head (gcLine),*/
  268.   tlFrame->gcLine = XCreateGC(tlFrame->dpyDraw, tlFrame->xidDraw, 0,0);    /* and the other for all other purposes (gc) (drawing notes, cables etc) */
  269.   XSetFont(tlFrame->dpyTime, tlFrame->gc, XLoadFont(tlFrame->dpyTime, "8x13"));    /* Load in a font for the GC */
  270.   XSetFunction (tlFrame->dpyDraw, tlFrame->gcLine, GXxor);        /* set to xor draw mode for the playback head GC so that the notes are not overwritten */
  271.   SetLineAttributes(tlFrame, 2);                    /* set the line attributes of the draw gc */
  272.   InitializeCMSdata(&(tlFrame->cms_data), red, green, blue);        /*  Initialize the color map segment and set up its RGB values */
  273.   
  274.   tlFrame->DrawScrollbarHor = xv_create(tlFrame->TimeLine_window->DrawCanvas, SCROLLBAR, /* create the canvas scrollbars */
  275.                     SCROLLBAR_DIRECTION, SCROLLBAR_HORIZONTAL, NULL);
  276.   tlFrame->DrawScrollbarVer = xv_create(tlFrame->TimeLine_window->DrawCanvas, SCROLLBAR, 
  277.                     SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL, NULL);
  278.   tlFrame->AppScrollbar = xv_create(tlFrame->TimeLine_window->AppCanvas, SCROLLBAR, 
  279.                     SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL, NULL); 
  280.   tlFrame->TimeScrollbar = xv_create(tlFrame->TimeLine_window->TimeCanvas, SCROLLBAR, 
  281.                      SCROLLBAR_DIRECTION, SCROLLBAR_HORIZONTAL, NULL); 
  282.   tlFrame->TimeScrollbarV = xv_create(tlFrame->TimeLine_window->TimeCanvas, SCROLLBAR, 
  283.                       SCROLLBAR_DIRECTION, SCROLLBAR_VERTICAL, NULL); 
  284.   Vobj = xv_get (tlFrame->AppScrollbar, SCROLLBAR_NOTIFY_CLIENT);   /* set notify interpose functions to enable the canvases to scroll together */
  285.   notify_interpose_event_func (Vobj, VerticalScrollHandler, NOTIFY_SAFE);
  286.   Hobj = xv_get (tlFrame->DrawScrollbarHor, SCROLLBAR_NOTIFY_CLIENT); /* Interpose functions for the horizontal scrollbars */
  287.   notify_interpose_event_func (Hobj, HorizontalScrollHandler, NOTIFY_SAFE);
  288.   
  289.   xv_set(tlFrame->DrawScrollbarVer, XV_SHOW, FALSE, NULL);        /* Hide the draw canvas vertical scrollbar and the TimeLine scrollbars */
  290.   xv_set(tlFrame->TimeScrollbar, XV_SHOW, FALSE, NULL);            /* since only one vertical and one horizontal scrollbar are required */
  291.   xv_set(tlFrame->TimeScrollbarV, XV_SHOW, FALSE, NULL);
  292.  
  293.   sprintf(cmsName, "palette%d", paletteName);
  294.   paletteName++;
  295.   xv_set(tlFrame->TimeLine_window->DrawCanvas,                /* Initialize the Draw Canvas. This is the canvas on which the cable and */
  296.      CANVAS_WIDTH, tlFrame->TimeLineLength,                /* notes are drawn.  The playback head is also drawn here. */
  297.      CANVAS_AUTO_SHRINK, FALSE,
  298.      WIN_CMS_NAME, cmsName,
  299.      WIN_CMS_DATA,   &(tlFrame->cms_data),
  300.      NULL);
  301.   xv_set(tlFrame->TimeLine_window->AppCanvas,                /* Initialize the App Canvas.  This is where the icons of the open applications */
  302.      CANVAS_AUTO_SHRINK, FALSE,
  303.      CANVAS_RETAINED, FALSE,
  304.      WIN_CMS_NAME, cmsName,
  305.      WIN_CMS_DATA,   &(tlFrame->cms_data),
  306.      NULL);
  307.   xv_set(tlFrame->TimeLine_window->TimeCanvas,                /* Initialize the TimeCanvas, where the timeline is drawn. */
  308.      CANVAS_AUTO_SHRINK, FALSE,
  309.      CANVAS_WIDTH, tlFrame->TimeLineLength,
  310.      WIN_CMS_NAME, cmsName,
  311.      WIN_CMS_DATA,   &(tlFrame->cms_data),
  312.      NULL);
  313.   xpixels = (int *)xv_get(tlFrame->TimeLine_window->DrawCanvas, 
  314.               WIN_X_COLOR_INDICES);                /* Get the indices in the colormap of the eight colors used and */ 
  315.   for (i=0; i < NumColors; i++)                        /* store them in the pixelTable array */
  316.     tlFrame->pixelTable[i] = xpixels[i];
  317.   free (xpixels);                            /* No longer required */
  318.   XSetForeground(tlFrame->dpyDraw, tlFrame->gcLine,            /* Set the color of the playback head to BLACK by xoring with the background color */
  319.          (long)tlFrame->pixelTable[Grey84]^(long)tlFrame->pixelTable[Black]);
  320. }
  321.  
  322. /*
  323.  * Initialize the colormap segment data and setup the RGB values.
  324.  * Called by CanvasInit (canvas.c). 
  325.  */
  326. InitializeCMSdata(cms_data, red, green, blue)
  327.      Xv_cmsdata      *cms_data;
  328.      unsigned char   *red, *green, *blue;
  329. {
  330.   (red)[Grey84]  = 214;      (green)[Grey84]  = 214;      (blue)[Grey84]  = 214;
  331.   (red)[Grey92]  = 235;      (green)[Grey92]  = 235;      (blue)[Grey92]  = 235;
  332.   (red)[Grey65]  = 166;      (green)[Grey65]  = 166;      (blue)[Grey65]  = 166;
  333.   (red)[White]   = 255;      (green)[White]   = 255;      (blue)[White]   = 255;
  334.   (red)[Red]     = 255;      (green)[Red]     = 0;        (blue)[Red]     = 0;
  335.   (red)[Unused2] = 235;      (green)[Unused2] = 235;      (blue)[Unused2] = 235;
  336.   (red)[Unused3] = 211;      (green)[Unused3] = 211;      (blue)[Unused3] = 211;
  337.   (red)[Black]   = 0;        (green)[Black]   = 0;        (blue)[Black]   = 0; 
  338.   cms_data->type = XV_STATIC_CMS;                    /* By setting to STATIC instead of DYNAMIC, the existing colormap will be */
  339.                                     /* used and the closest color that comes to those specified above will be */
  340.                                     /* chosen. */
  341.   cms_data->size = NumColors;
  342.   cms_data->rgb_count = NumColors;
  343.   cms_data->index = 0;
  344.   cms_data->red = red;
  345.   cms_data->green = green;
  346.   cms_data->blue = blue;
  347. }
  348.  
  349. /*
  350.  * Function to set the line attributes of the graphics context. 
  351.  * Called by CanvasInit (canvas.c).
  352.  */
  353. SetLineAttributes(tlFrame, linewidth)
  354.      TimeLineFramePtr tlFrame;
  355.      int linewidth;
  356. {
  357.   int     line_width = linewidth;
  358.   int    line_style = LineSolid;
  359.   int     cap_style  = CapRound;
  360.   int     join_style = JoinRound;
  361.   XSetLineAttributes(tlFrame->dpyDraw, tlFrame->gc, line_width, line_style, cap_style, join_style);
  362. }
  363.  
  364. /*
  365.  * Function to set the height of the canvases.  This is done by checking the number of open applications and then setting the height attributes for
  366.  * the three canvases.
  367.  * Called by DrawCanvasRepaintHandler(canvas.c), UpdateAppsHandler(openApps.c).
  368.  */
  369. void SetCanvasHeight(tlFrame)
  370.      TimeLineFramePtr tlFrame;
  371. {
  372.   int height;                                /* The height of the App canvas viewing window. */
  373.   int position;                                /* Y position of the top left corner of the Time canvas */
  374.   
  375.   if (tlFrame->numberOfApps < 8) 
  376.     height = (tlFrame->numberOfApps + 1) * (IconHeight + IconGap) + (IconHeight/2);
  377.   else 
  378.     height = (IconHeight + IconGap) * 8 + (IconHeight/2);
  379.   
  380.   position = xv_get(tlFrame->TimeLine_window->DrawCanvas, XV_Y);    /* Get the position of the Draw canvas */
  381.   position += height - (IconHeight + IconGap);                /* Add the height of the Draw canvas to the position to obtain the desired */
  382.                                     /* position for the Time canvas */
  383.   xv_set(tlFrame->TimeLine_window->AppCanvas,                /* Now set the height for all the three canvases */
  384.      CANVAS_HEIGHT, (tlFrame->numberOfApps + 1) * (IconHeight + IconGap) + (IconHeight/2),
  385.      XV_HEIGHT, height,
  386.      NULL);
  387.   xv_set(tlFrame->TimeLine_window->DrawCanvas,
  388.      CANVAS_HEIGHT, (tlFrame->numberOfApps + 1) * (IconHeight + IconGap) + (IconHeight/2),
  389.      XV_HEIGHT, height - (IconHeight + IconGap),
  390.      NULL);
  391.   xv_set(tlFrame->TimeLine_window->TimeCanvas,
  392.      XV_Y, position,
  393.      CANVAS_HEIGHT, (IconHeight + IconGap),
  394.      XV_HEIGHT, (IconHeight + IconGap),
  395.      NULL);
  396.   window_fit_height(tlFrame->TimeLine_window->window);
  397. }
  398.  
  399. /*
  400.  * Event callback function for `TimeCanvas'.
  401.  * At present, nothing is done in this event handler for the TimeCanvas.
  402.  */
  403. Notify_value TimeCanvasEventHandler(win, event, arg, type)
  404.      Xv_window        win;
  405.      Event            *event;
  406.      Notify_arg        arg;
  407.      Notify_event_type     type;
  408. {
  409.   return notify_next_event_func(win, (Notify_event) event, arg, type);
  410. }
  411.  
  412. /*
  413.  * Repaint callback function for `TimeCanvas'.
  414.  * This function clears the TimeCanvas and redraws the timeline.
  415.  */
  416. void TimeCanvasRepaintHandler(canvas, paint_window, display, xid, rects)
  417.      Canvas        canvas;
  418.      Xv_window        paint_window;
  419.      Display        *display;
  420.      Window        xid;
  421.      Xv_xrectlist    *rects;
  422. {
  423.   TimeLineFramePtr tlFrame;
  424.   TimeLine_window_objects    *ip = (TimeLine_window_objects *) xv_get(canvas, XV_KEY_DATA, INSTANCE);
  425.  
  426.   tlFrame = TimeLineWindow[xv_get(ip->controls, PANEL_CLIENT_DATA)];
  427.   XClearWindow(tlFrame->dpyTime, tlFrame->xidTime);            /* clear the whole display in the TimeCanvas. */
  428.   DrawTimeLine(tlFrame);                        /* Draw the timeline */
  429. }
  430.